/**
 * 
 */
package org.jinion.database.model.impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jinion.database.model.AbstractResult;
import org.jinion.database.model.AbstractTable;
import org.jinion.exception.JinionException;

/**
 * Default implementation for AbstractResult.
 * @author zhlmmc
 *
 */
public class DefaultResult extends AbstractResult {
	private static final Log log = LogFactory.getLog(DefaultResult.class);
	
	public DefaultResult(int affectedRows, ResultSet generatedKeys, ResultSet resultSet) throws SQLException{
		super(affectedRows, generatedKeys, resultSet);
	}

	protected AbstractTable buildTable(ResultSet resultSet) {
		try {
			DefaultTable table = new DefaultTable(resultSet);
			resultSet.close();
			return table;
		} catch (JinionException e) {
			log.error(e);
		} catch (SQLException e){
			log.error(e);
		}
		
		return null;
	}
	
}
